package com.lzh.shijicloudstack.exception;


import com.lzh.shijicloudstack.config.enums.request.AppHttpCodeEnum;
import com.lzh.shijicloudstack.config.enums.request.ErrorCodeEnum;

/**
 * @author luzhiheng
 * @date 2023-11-23
 */
public class LzhException extends RuntimeException {

    private final int code;

    private final String msg;

    public LzhException(String msg) {
        super(msg);
        this.msg = msg;
        this.code = 500;
    }

    public int getCode() {
        return code;
    }

    public String getMsg() {
        return msg;
    }

    public LzhException(AppHttpCodeEnum httpCodeEnum) {
        super(httpCodeEnum.getMsg());
        this.code = httpCodeEnum.getCode();
        this.msg = httpCodeEnum.getMsg();
    }

    public LzhException(ErrorCodeEnum errorCodeEnum) {
        super(errorCodeEnum.getMsg());
        this.code = errorCodeEnum.getCode();
        this.msg = errorCodeEnum.getMsg();
    }

}
